<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:composite="http://java.sun.com/jsf/composite"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:a4j="http://richfaces.org/a4j"
  xmlns:zanata="http://java.sun.com/jsf/composite/zanata">

<composite:interface>
  <composite:attribute name="filterActionBean"
    type="org.zanata.ui.AbstractListFilter"
    shortDescription="action bean for maintainer filtering" required="true"/>

  <composite:attribute name="listSize" type="java.lang.Integer"
    shortDescription="size of maintainer list (without filtering)" default="0"/>

  <composite:attribute name="settingsUrl" type="java.lang.String"
    shortDescription="Hash URL for maintainers settings page" required="true"/>

  <composite:attribute name="PermissionToUpdate" type="java.lang.Boolean"
    shortDescription="user has permission to update" required="true"/>

</composite:interface>

<composite:implementation>
  <div class="panel">
    <div class="panel__header">
      <h2 class="panel__heading">#{msgs['jsf.Maintainers']}</h2>
    </div>

    <div class="panel__sub-header js-reveal">
      <zanata:list-filter status="maintainerTab-maintainersLoader"
        listId="maintainers-form"
        render="maintainers-form, maintainerSearchBottom-pager, maintainerSearchBottom-page-info"
        id="maintainerSearch" iconClass="i--users"
        placeholder="#{msgs['jsf.maintainer.search.placeholder']}"
        actionBean="#{cc.attrs.filterActionBean}"/>
    </div>

    <a4j:status name="maintainerTab-maintainersLoader">
      <f:facet name="start">
        <zanata:loader/>
      </f:facet>
    </a4j:status>

    <h:form id="maintainers-form" styleClass="l--push-bottom-1">
      <h:panelGroup layout="block"  styleClass="l--pad-all-half" rendered="#{cc.attrs.listSize lt 1}">
        <p class="txt--meta">#{msgs['jsf.NoMaintainers']}</p>
        <ui:fragment rendered="#{cc.attrs.PermissionToUpdate}">
          <p>
            <a class="button--primary" href="#{cc.attrs.settingsUrl}"
              onclick="changeBrowserUrl(this.href, true);return false;">
              #{msgs['jsf.AddAMaintainer']}
              <i class="i i--add i__item__icon"></i>
            </a>
          </p>
        </ui:fragment>
      </h:panelGroup>

      <h:panelGroup layout="block"  styleClass="l--pad-all-half"
        rendered="#{cc.attrs.listSize gt 1 and empty cc.attrs.filterActionBean.currentPage}">
        <p class="txt--meta">#{msgs['jsf.search.NoResult']}</p>
      </h:panelGroup>

      <ui:fragment
        rendered="#{not empty cc.attrs.filterActionBean.currentPage}">
        <ul class="list--slat">
          <ui:repeat value="#{cc.attrs.filterActionBean.currentPage}" var="maintainer">
            <li class="l--pad-all-half">
              <zanata:person-tile person="#{maintainer}" styleClass="bx--block"/>
            </li>
          </ui:repeat>
        </ul>
      </ui:fragment>
    </h:form>

    <zanata:list-filter status="maintainerTab-maintainersLoader"
      listId="maintainers-form"
      render="maintainers-form, maintainerSearch-pager, maintainerSearch-page-info"
      id="maintainerSearchBottom" iconClass="i--users" bottomPanel="true"
      placeholder="#{cc.attrs.placeholder}"
      actionBean="#{cc.attrs.filterActionBean}"/>
  </div>
</composite:implementation>
</html>
